package com.demo.hive

import org.apache.spark.sql.SparkSession

object LocalDebugSparkSQL {

  def main(args: Array[String]): Unit = {

    System.setProperty("hadoop.home.dir", "E:\\hadoop-common-2.7.3-bin-master")

    val spark = SparkSession
      .builder()
      .appName("Spark Hive Example")
      .master("local[2]")
      .enableHiveSupport()
      .getOrCreate()

    spark.sql("use brsface")
    spark.sql("show tables").collect().foreach(println)
    spark.sql(" select * from metric_day_passinfo_t where dt='2018-06-27' limit 5").show

    spark.stop()
  }

}
